﻿@model List<CMP.ERP.Model.Shipments>
@{
    Layout = null;
}
@Html.Action("Account_Show", "Account");
    <div class="content">
        <div class="right" id="mainFrame">
            <div class="right_cont">
                <div id="middle">
            
                    <div class="Switch"></div>
                    <script type="text/javascript">
                        $(document).ready(function (e) {
                            $(".Switch").click(function () {
                                $(".left").toggle();

                            });
                        });
                    </script>
                    <div class="right" id="mainFrame">

                        <div class="right_cont">
                            <ul class="breadcrumb">
                                当前位置：
                                <a href="/Home/Index">首页</a>
                                <span class="divider">/</span>
                                发货单信息
                            </ul>
                            <div class="title_right"><strong>发货单信息</strong></div>
                            <div style="width:100%; margin:auto">
                                <div>

                                </div>
                                <div style="margin-top:20px;">
                                    <table class="table  table-hover table-bordered table-striped">
                                        <thead>
                                            <tr>
                                                <th>下单时间</th>
                                                <th>收货人</th>
                                                <th>联系方式</th>
                                                <th>订单状态</th>
                                                <th>快递名称</th>
                                                <th>仓库名称</th>
                                                <th>总金额</th>
                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            @foreach (var itme in Model)
                                            {
                                                <tr>
                                                    <td>@itme.Shipments_data</td>
                                                    <td>@itme.Shipments_Per</td>
                                                    <td>@itme.Shipments_Phone</td>
                                                    <td>@itme.Shipments_State</td>
                                                    <td>@itme.Express_Company_Name</td>
                                                    <td>@itme.WareHose_Name</td>
                                                    <td>@itme.Shipments_SumMoney</td>
                                                    <td>
                                                        <a href="/Fahuo/DetailsShipmentsShow/@itme.Shipments_Id">详情</a>
                                                    </td>
                                                </tr>
                                            }
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<script>
    $(function () {
        $.ajax({
            type: "get",
            url: "/Order/show",
            success: function (data) {

                $(data).each(function (index, item) {

                    var pup = "<tr><td><input name='ck' id='Checkbox" + item.Commodity_Id + "' type='checkbox' value='" + item.Commodity_Id + "' name='ck'/></td><td>" + item.Commodity_Id + "</td><td>" + item.Commodity_Name + "</td><td>" + item.Commodity_number + "</td><td>" + item.Commodity_Weight + "</td><td>" + item.Commodity_Remark + "</td><td>" + item.CommodityType_Name + "</td><td name='ck' id='ss" + item.Commodity_Id + "'>" + item.Commodity_Price + "</td><td><input name='pc' id=" + item.Commodity_Id + " type='text' /></td></tr>";
                    $("#pss tbody").append(pup);
                })
            }
        })
    })
    function mg() {
        var Shipments_Per = $("[name='Shipments_Per']").val();
        var Shipments_Phone = $("[name='Shipments_Phone']").val();
        var options1 = $("#Express_Company_Id   option:selected").val();
        var option = $("#WareHose_Id option:selected").val();
        ($(":checkbox").each(function () {

            if ($(this).attr("checked") == "checked") {
                var po = $(this).val();
            }

        }))
        var num = "";
        var selectval = "";
        var price = "";
        var list = $("[name='ck']:checked");
        $(list).each(function (index, item) {
            ss = $(item).val();
            num += $("#" + ss + "").val() + ",";
            price += $("#ss" + ss + "").html() + ",";
            if (selectval.length > 0) {
                selectval += ",";
            }
            selectval += $(item).val();
        })
        num = num.substr(0, num.length - 1);
        price = price.substr(0, price.length - 1);
        $.ajax({
            type: "post",
            url: "/Order/add",
            data: {
                Shipments_Per: Shipments_Per,
                Shipments_Phone: Shipments_Phone,
                ShipmentMate_num: num,
                Express_Company_Id: options1,
                WareHose_Id: option,
                Commodity_Id: selectval,
                Commodity_price: price
            },
            success: function (data) {
                if (data == "True") {
                    alert("Ok");
                    location.href = "/Order/Order_show";
                }
                else {
                    alert("No");
                }
            },
            error: function () {

                alert("失败,粗错了");
            }
        })
    }
</script>



